import type { RouteRecordRaw } from 'vue-router'

const loadComponent = (name: string) => {
  return () => import(/* webpackChunkName: "eci" */ `@/views/eci/${name}/index.vue`)
}
const loadComponentTodo = (name: string) => {
  return () => import(/* webpackChunkName: "workbench" */ `@/views/${name}/index.vue`)
}

export const routes: Array<RouteRecordRaw> = [
  {
    path: '/emissionInventory',
    component: loadComponent('inventory'),
    name: 'InventoryList',
    meta: {
      title: '监测计划管理',
      keepAlive: true,
      activeMenu: '/eci'
    }
  },
  {
    path: '/emissionInventory/plan',
    component: loadComponent('inventory/plan'),
    name: 'CreateInventory',
    meta: {
      title: '监测计划详情',
      selectKeysPath: '/emissionInventory',
      keepAliveParentName: ['InventoryList'],
      breadcrumb: [
        {
          name: '监测计划管理',
          path: '/emissionInventory'
        },
        {
          name: '监测计划详情',
          path: false
        }
      ],
      activeMenu: '/eci'
    }
  },
  {
    path: 'dataManagement/fillInConfig',
    component: loadComponent('dataManagement/fillInConfig'),
    name: 'FillInConfig',
    meta: {
      title: '填报配置',
      selectKeysPath: '/dataManagement/fillInTask',
      breadcrumb: [
        {
          name: '活动数据填报',
          path: '/dataManagement/fillInTask'
        },
        {
          name: '填报配置',
          path: false
        }
      ],

      activeMenu: '/eci'
    }
  },
  {
    path: 'dataManagement/fillInTask',
    component: loadComponent('dataManagement/fillInTask'),
    name: 'FillInTask',
    meta: { title: '活动数据填报', activeMenu: '/eci', keepAlive: true }
  },
  {
    path: 'dataManagement/fillInTask/detail',
    component: loadComponentTodo('todo/detail'),
    name: 'DataManagementTodoListDetail',
    meta: {
      title: '活动数据填报详情',
      bgColor: '#EDF2F5',
      keepAliveParentName: ['FillInTask'],
      breadcrumb: [
        {
          name: '活动数据填报',
          path: '/dataManagement/fillInTask'
        },
        {
          name: '活动数据填报详情',
          path: false
        }
      ],
      activeMenu: '/eci'
    }
  },
  {
    path: 'dataManagement/activeDataDetail',
    component: loadComponent('dataManagement/detail'),
    name: 'ActiveDataDetail',
    meta: { title: '活动数据明细', activeMenu: '/eci' }
  },
  {
    path: 'inventoryTask/taskList',
    component: loadComponent('emissionAccounting/inventoryTask'),
    name: 'InventoryTaskList',
    meta: {
      title: '盘查任务',
      keepAlive: true,
      activeMenu: '/eci'
    }
  },
  {
    path: 'inventoryTask/taskList/taskDetail/:taskNo',
    component: loadComponent(`emissionAccounting/inventoryTask/taskDetail`),
    name: 'InventoryTaskDetail',
    meta: {
      title: '盘查任务详情',
      selectKeysPath: '/inventoryTask/taskList',
      breadcrumb: [
        {
          name: '盘查任务',
          path: '/inventoryTask/taskList'
        },
        {
          name: '盘查任务详情',
          path: false
        }
      ],
      keepAliveParentName: 'InventoryTaskList',
      activeMenu: '/eci'
    }
  },
  {
    path: 'carbonManagement/carbonList',
    component: loadComponent('emissionAccounting/carbonManagement/carbonList'),
    name: 'CarbonList',
    meta: {
      title: '清册及报告',
      keepAlive: true,
      activeMenu: '/eci'
    }
  },
  {
    path: 'carbonManagement/carbonList/carbonDetail',
    component: loadComponent(`emissionAccounting/carbonManagement/carbonList/carbonDetail`),
    meta: {
      title: '碳排放信息详情',
      selectKeysPath: '/carbonManagement/carbonList',
      breadcrumb: [
        {
          name: '清册及报告',
          path: '/carbonManagement/carbonList'
        },
        {
          name: '清册详情',
          path: false
        }
      ],
      keepAliveParentName: 'CarbonList',
      activeMenu: '/eci'
    }
  },
  {
    path: 'emissionAccounting/detail',
    component: loadComponent('emissionAccounting/detail'),
    name: 'EmissionAccountingDetail',
    meta: {
      title: '碳排放核算明细',
      activeMenu: '/eci'
    }
  },
  {
    path: 'reportFormManagement/report',
    component: loadComponent('reportFormManagement/report'),
    name: 'Report',
    meta: {
      title: '统计报表',
      keepAlive: true,
      activeMenu: '/eci',
      selectKeysPath: '/inventoryTask/taskList',
      breadcrumb: [
        {
          name: '盘查任务',
          path: '/inventoryTask/taskList'
        },
        {
          name: '盘查任务详情',
          path: `/inventoryTask/taskList/taskDetail/:inventoryTaskId`
        },
        {
          name: '统计报表',
          path: false
        }
      ]
    }
  }
  // {
  //   path: '/visualizedAnalysis/analysis/distribution',
  //   component: loadComponent('visualizedAnalysis/analysis'),
  //   name: 'AnalysisDistribution',
  //   meta: {
  //     title: '碳排放分布分析',
  //     activeMenu: '/eci'
  //   }
  // },
  // {
  //   path: '/visualizedAnalysis/analysis/tendency',
  //   component: loadComponent('visualizedAnalysis/analysis'),
  //   name: 'AnalysisTendency',
  //   meta: {
  //     title: '碳排放趋势分析',
  //     activeMenu: '/eci'
  //   }
  // }
]

export default routes
